#include "ext_node_func.h"


void ext_node_func_release()
{
    ext_node_func_example_release();
    ext_node_func_device_io_release();
    return;
}

void ext_node_func_register()
{
    ext_node_func_example_init();
    ext_node_func_device_io_init();
    return;
}

void ext_node_func_init_msg_queue(flow_node_base_t *node, flow_messge_t *msg)
{
    if (msg == NULL)
    {   
        CENGINE_LOG(CENGINE_LOG_ERR, "msg is NULL,init msg queue failed");
        return;
    }

    // find trigger for const
    if (node->enode_type == EXT_NODE_TYPE_INPUT)
    {
        flow_node_base_t *temp_node = NULL;

        temp_node = cengine_find_flow_node_by_id(node->actrigger_id);
        node->usrepeat = temp_node->usrepeat;

        CENGINE_LOG(CENGINE_LOG_INFO, "fill repeat for const,id:%s repeat:%d node_type:%s", node->acnode_id, (int) node->usrepeat, node->acnode_type);
    }
    
    // put init node to msg queue
    if (node->enode_type == EXT_NODE_TYPE_INPUT||node->enode_type == EXT_NODE_TYPE_OUTPUT)
    {   
        msg->pmsg_node = node;        
        CENGINE_LOG(CENGINE_LOG_INFO, "fill msg for init node,id:%s node_type:%s", node->acnode_id, node->acnode_type);
    }
}


